home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
ctutor.exe
/
SOURCE
/
PRINTDAT.C
< prev
next >
Wrap
C/C++ Source or Header
|
1994-05-15
|
799b
|
32 lines
/* Chapter 10 - Program 8 - PRINTDAT.C */
#include "stdio.h"
void main()
{
FILE *funny, *printer;
char c;
funny = fopen("TENLINES.TXT", "r"); /* open input file */
printer = fopen("PRN", "w"); /* open printer file */
do {
c = getc(funny); /* get one character from the file */
if (c != EOF) {
putchar(c); /* display it on the monitor */
putc(c, printer); /* print the character */
}
} while (c != EOF); /* repeat until EOF (end of file) */
fclose(funny);
fclose(printer);
}
/* Result of execution
(The file named TENLINES.TXT is listed
on the printer, and it is listed on the monitor.)
*/